<!DOCTYPE html>
<html lang="en">
    <head>
        <title></title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <body>
        <script>
            // const func = () => {

            // };
            // 相当于
            // var func = (function(){
                
            // }).bind(this); // 自动柯里化函数

            // 用处
            function type(){
                this.name = "name";
                setTimeout(function() {
                    console.log("普通ES5:" + this.name);  //获取不到 this指向window
                });
                
                setTimeout((function() {
                    console.log("柯里化ES5:" + this.name);
                }).bind(this));

                setTimeout(() => {
                    console.log(`ES6:${ this.name }`);
                });
            }
            new type();
            
            // 构造函数
            const ES6Type = ()=> {
                this.name = "name";
            };

            try{
                const ES6 = new ES6Type(); // 无法作为构造函数
            }
            catch(e){
                console.log(e);
            }

        </script>
    </body>
</html>